package com.exam;

import java.time.LocalDateTime;

public class MyThread implements Runnable{
    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        new Thread(myThread).start();
        System.out.println("主线程启动时间" + LocalDateTime.now());
        new Thread(() -> {

                System.out.println("测试");

        }).start();
    }
    MyThread(){
        System.out.println("线程创建成功");
    }
    @Override
    public void run() {
        try {
            Thread.sleep(8000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程已启动" + LocalDateTime.now());
    }
}
